<?php 
require_once 'config/config.php';
class db {
    public $connection;
    public function getconnection() {
        $this->connection = mysql_connect(DB_HOST . ":" . DB_PORT, DB_USER, DB_PASS);
        mysql_select_db(DB_NAME, $this->connection) ;
    }
    public function query($query){
        mysql_query('SET NAMES utf8' , $this->connection);//ma hoa tieng viet
        $data = mysql_query($query , $this->connection);// truyen query
        $rows = array();
         while ($row = mysql_fetch_assoc($data)) {
            $rows[] = $row;
        }
        return $rows;
    }
    
}

